package com.zzc.repository;

import com.zzc.domain.UserInfor;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

public interface UserInforRep extends JpaRepository<UserInfor,String> {

    @Query(value = "select * from USERINFOR where USER_ID = ?1",nativeQuery = true)
    UserInfor findByUserId(String id);

    @Modifying
    @Transactional
    @Query(value = "UPDATE USERINFOR SET USER_PHONE_NUMBER = ?1 , USER_ADDRESS = ?2,REAL_NAME = ?3 WHERE USER_ID = ?4",nativeQuery = true)
    void upDateByUserId(String phone,String address, String name,String id);
}
